package com.dianping.cat.configuration.message.transform;

import com.dianping.cat.configuration.message.entity.AtomicMessageConfig;
import com.dianping.cat.configuration.message.entity.Domain;
import com.dianping.cat.configuration.message.entity.Property;
import org.xml.sax.Attributes;






public class DefaultSaxMaker
  extends Object
  implements IMaker<Attributes>
{
/* 17 */   public AtomicMessageConfig buildAtomicMessageConfig(Attributes attributes) { return new AtomicMessageConfig(); }





  public Domain buildDomain(Attributes attributes) {
/* 24 */     String id = attributes.getValue("id");
/* 25 */     return new Domain(id);
  }




  public Property buildProperty(Attributes attributes) {
/* 32 */     String name = attributes.getValue("name");
/* 33 */     String value = attributes.getValue("value");
/* 34 */     Property property = new Property(name);

/* 36 */     if (value != null) {
/* 37 */       property.setValue(value);
    }

/* 40 */     return property;
  }


  protected <T> T convert(Class<T> type, String value, T defaultValue) {
/* 45 */     if (value == null || value.length() == 0) {
/* 46 */       return defaultValue;
    }

/* 49 */     if (type == Boolean.class || type == boolean.class)
/* 50 */       return (T)Boolean.valueOf(value); 
/* 51 */     if (type == Integer.class || type == int.class)
/* 52 */       return (T)Integer.valueOf(value); 
/* 53 */     if (type == Long.class || type == long.class)
/* 54 */       return (T)Long.valueOf(value); 
/* 55 */     if (type == Short.class || type == short.class)
/* 56 */       return (T)Short.valueOf(value); 
/* 57 */     if (type == Float.class || type == float.class)
/* 58 */       return (T)Float.valueOf(value); 
/* 59 */     if (type == Double.class || type == double.class)
/* 60 */       return (T)Double.valueOf(value); 
/* 61 */     if (type == Byte.class || type == byte.class)
/* 62 */       return (T)Byte.valueOf(value); 
/* 63 */     if (type == Character.class || type == char.class) {
/* 64 */       return (T)Character.valueOf(value.charAt(0));
    }
/* 66 */     return (T)value;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-core-3.0.0.jar!/com/dianping/cat/configuration/message/transform/DefaultSaxMaker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */